#define _CRT_SECURE_NO_WARNINGS 1


#include<iostream>

using namespace std;

int _QuickSort(int* arr, int left, int right)
{
	int key = left++;
	while (left <= right)
	{
		while (left <= right && arr[right] < arr[key])
		{
			right--;
		}
		while (left <= right && arr[left] > arr[key])
		{
			left++;
		}
		if (left <= right)
		{
			swap(arr[left++], arr[right--]);
		}
	}
	swap(arr[right], arr[key]);
	return right;
}

void QuickSort(int* arr, int left, int right)
{
	if (left >= right)
	{
		return;
	}
	int key = _QuickSort(arr, left, right);
	QuickSort(arr, left, key - 1);
	QuickSort(arr, key + 1, right);
}

//int main()
//{
//	int arr[3] = { 0 };
//	for (int i = 0; i < 3; i++)
//	{
//		cin >> arr[i];
//	}
//	QuickSort(arr, 0, 2);
//	for (auto& e : arr)
//	{
//		cout << e << ' ';
//	}
//	cout << endl;
//	
//	return 0;
//}